#ifndef SERVER_PROCESS_H_
#define SERVER_PROCESS_H_

#include "stddef.h"

#include <vector>
#include <string>
class Buffer;
class UserInfoManagement;

class ServerProcess
{
public: 
	ServerProcess(const std::string& dbName);
	~ServerProcess();
	int Init(int fd);
	int Recive(int sockfd, unsigned char* buffer, size_t size);
	int GetPack(int sockfd, void* buffer, size_t size);
	int GetPack(int sockfd, Buffer& buffer);
	QueryResult Process(const unsigned char* buffer, size_t size);
private:
	typedef std::vector<Buffer*> BufferMap;
	typedef BufferMap::iterator MapIter;
	BufferMap m_serverBuffer;
	UserInfoManagement* m_userInfo;

	int checkPack(Buffer*);

	ServerProcess(const ServerProcess&);
	ServerProcess& operator=(const ServerProcess&);
};

#endif
